﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>Microwave02: Microwave.h Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                Examples using state machines generated by StateBuilderCpp
            </h1>
            <h3>
                Microwave02: Microwave.h Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">Microwave.h</div>  </div>
</div>
<div class="contents">
<a href="_microwave_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef __WASHING_MACHINE__</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define __WASHING_MACHINE__</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;cstdlib&gt;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#pragma warning(push, 0)</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/*#ifdef _MSC_VER*/</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;boost/thread/thread.hpp&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;boost/bind.hpp&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;boost/thread/mutex.hpp&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;boost/shared_ptr.hpp&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#pragma warning(pop)</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/*#ifdef _MSC_VER*/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="keyword">using namespace </span>std;
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="keyword">class </span>MicrowaveContext;
<a name="l00023"></a>00023 
<a name="l00024"></a><a class="code" href="class_microwave.html">00024</a> <span class="keyword">class </span><a class="code" href="class_microwave.html">Microwave</a>
<a name="l00025"></a>00025 {
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="keyword">public</span>:
<a name="l00028"></a>00028     <a class="code" href="class_microwave.html">Microwave</a>();
<a name="l00029"></a>00029 
<a name="l00030"></a>00030     ~<a class="code" href="class_microwave.html">Microwave</a>();
<a name="l00031"></a>00031 
<a name="l00032"></a>00032     <span class="comment">//Start the worker threads</span>
<a name="l00033"></a>00033     <span class="keywordtype">void</span> workersStart();
<a name="l00034"></a>00034 
<a name="l00035"></a>00035     <span class="comment">//Stop the worker threads</span>
<a name="l00036"></a>00036     <span class="keywordtype">void</span> workersStop();
<a name="l00037"></a>00037 
<a name="l00038"></a><a class="code" href="class_microwave.html#a91a8dac07ba5c0c5a93d978c3ad0429e">00038</a>     <span class="keywordtype">int</span> <a class="code" href="class_microwave.html#a91a8dac07ba5c0c5a93d978c3ad0429e">GetRtxCounter</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> iRtxCount;}
<a name="l00039"></a>00039 
<a name="l00040"></a>00040     <span class="comment">//Events</span>
<a name="l00041"></a>00041     <span class="keywordtype">void</span> evStart();
<a name="l00042"></a>00042     <span class="keywordtype">void</span> evStop();
<a name="l00043"></a>00043     <span class="keywordtype">void</span> evTurnOn();
<a name="l00044"></a>00044     <span class="keywordtype">void</span> evTurnOff();
<a name="l00045"></a>00045     <span class="keywordtype">void</span> evCookingDone();
<a name="l00046"></a>00046     <span class="keywordtype">void</span> evDoorOpened();
<a name="l00047"></a>00047     <span class="keywordtype">void</span> evDoorClosed();
<a name="l00048"></a>00048 
<a name="l00049"></a>00049     <span class="comment">//Actions</span>
<a name="l00050"></a>00050     <span class="keywordtype">void</span> Print(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; message);
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <span class="keyword">private</span>:
<a name="l00053"></a>00053 
<a name="l00054"></a>00054     MicrowaveContext&amp; GetContext();
<a name="l00055"></a><a class="code" href="class_microwave.html#ade8a3fc751fde19161408844833bda23">00055</a>     MicrowaveContext *<a class="code" href="class_microwave.html#ade8a3fc751fde19161408844833bda23">m_pContext</a>;
<a name="l00056"></a><a class="code" href="class_microwave.html#aab9533a3e37add11113ab8333a99e17a">00056</a>     <span class="keywordtype">bool</span> <a class="code" href="class_microwave.html#aab9533a3e37add11113ab8333a99e17a">m_bRun</a>;
<a name="l00057"></a><a class="code" href="class_microwave.html#ab9f207cb699db8ef6fcc2f8e808be829">00057</a>     <span class="keywordtype">int</span> <a class="code" href="class_microwave.html#ab9f207cb699db8ef6fcc2f8e808be829">iRtxCount</a>;
<a name="l00058"></a><a class="code" href="class_microwave.html#a7ed1c6ec309df83004ec4ff33fa5b6db">00058</a>     <span class="keywordtype">int</span> <a class="code" href="class_microwave.html#a7ed1c6ec309df83004ec4ff33fa5b6db">iCounter</a>;
<a name="l00059"></a>00059     <span class="keywordtype">void</span> doorWorker();
<a name="l00060"></a>00060     <span class="keywordtype">void</span> userWorker();
<a name="l00061"></a>00061 
<a name="l00062"></a><a class="code" href="class_microwave.html#ac15ca147a5c1c50b84bfc381d49e30b8">00062</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_microwave.html#ac15ca147a5c1c50b84bfc381d49e30b8">m_eventsCountDoor</a>;
<a name="l00063"></a><a class="code" href="class_microwave.html#ab307e9aac752df52f87d36e0b92948c9">00063</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_microwave.html#ab307e9aac752df52f87d36e0b92948c9">m_eventsCountUser</a>;
<a name="l00064"></a><a class="code" href="class_microwave.html#a1ec277e6d13d0a963814a13ccc6fa350">00064</a>     boost::shared_ptr&lt;boost::thread&gt; <a class="code" href="class_microwave.html#a1ec277e6d13d0a963814a13ccc6fa350">m_threadDoor</a>;
<a name="l00065"></a><a class="code" href="class_microwave.html#aba6011d88a4d6311971a534726facc06">00065</a>     boost::shared_ptr&lt;boost::thread&gt; <a class="code" href="class_microwave.html#aba6011d88a4d6311971a534726facc06">m_threadUser</a>;
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 };
<a name="l00068"></a>00068 
<a name="l00069"></a>00069 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
